<?php


namespace app\common\model;


use think\Cache;

class Channel extends BaseModel
{
    protected $name = 'channel';

    /**
     * 所有分类
     * @return mixed
     */
    public static function getALL()
    {
        $model = new static;
        if (!Cache::get('channel_' . $model::$wxapp_id)) {
            $data = $model->order([ 'create_time' => 'asc' ])->select();
            $all = !empty($data) ? $data->toArray() : [];
            Cache::set('channel_' . $model::$wxapp_id,$data);
        }
        return Cache::get('channel_' . $model::$wxapp_id);
    }
}